home *** CD-ROM | disk | FTP | other *** search
/ Aminet 49 / Aminet 49 (2002)(GTI - Schatztruhe)[!][Jun 2002].iso / Aminet / util / misc / ReportPlus.lha / ReportPlus / source / f1.c < prev    next >
C/C++ Source or Header  |  2002-04-15  |  67KB  |  1,938 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <proto/exec.h>
  4. #include <intuition/intuition.h>
  5. #include <intuition/gadgetclass.h>
  6. #include <proto/intuition.h>
  7. #include <libraries/gadtools.h>
  8. #include <proto/gadtools.h>
  9. #include <dos/dos.h>
  10. #include <proto/dos.h>
  11. #include <graphics/gfx.h>
  12. #include <clib/graphics_protos.h>
  13.  
  14. #include <clib/alib_protos.h>
  15. #include <ctype.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include "rp.h"
  19.  
  20. #define ALL_REACTION_CLASSES
  21. #include <reaction/reaction.h>
  22. #include <clib/texteditor_protos.h>
  23. #include <gadgets/texteditor.h>
  24. #include <pragmas/texteditor_pragmas.h>
  25.  
  26. #define SUBSYSTEMS   127
  27. #define CPUS           4
  28. #define MODELS        13
  29. #define MAXELEMENTS_1  4 // counting from 0
  30.  
  31. MODULE void refreshpv(void);
  32. MODULE void updatereportgadgets(void);
  33. MODULE void readreportgadgets(void);
  34. MODULE ULONG Hook1Func(struct Hook *h, VOID *o, VOID *msg);
  35. MODULE void updateemail(void);
  36.  
  37. AGLOBAL struct ReportStruct report;
  38.  
  39. MODULE struct Gadget*  report_gadgets[GIDS_1 + 1];
  40. MODULE ABOOL           SubsystemNodes          = FALSE;
  41. MODULE struct List     SubsystemList;
  42. MODULE struct Gadget  *CY11_Type               = NULL,
  43.                       *CY11_Severity           = NULL,
  44.                       *BU11_PathnameASL        = NULL,
  45.                       *BU11_Sender             = NULL,
  46.                       *BU11_TextEditor         = NULL,
  47.                       *IN11_Floppies           = NULL,
  48.                       *LV11_Subsystem          = NULL,
  49.                       *MX11_Model              = NULL,
  50.                       *MX11_Agnus              = NULL,
  51.                       *MX11_CPU                = NULL,
  52.                       *ST11_Debug              = NULL,
  53.                       *ST11_KS                 = NULL,
  54.                       *ST11_WB                 = NULL,
  55.                       *ST11_Pathname           = NULL,
  56.                       *ST11_Version            = NULL,
  57.                       *ST11_3rdName            = NULL,
  58.                       *ST11_3rdVer             = NULL,
  59.                       *ST11_3rdManuf           = NULL,
  60.                       *ST11_Chip               = NULL,
  61.                       *ST11_Fast               = NULL,
  62.                       *ST11_Hard               = NULL,
  63.                       *ST11_Expansion          = NULL,
  64.                       *ST11_Summary            = NULL,
  65.                       *TE11_3rdLabel           = NULL,
  66.                       *TE11_EMailTo            = NULL,
  67.                       *TE11_ModelText          = NULL,
  68.                       *TE11_AgnusText          = NULL,
  69.                       *TE11_CPUText            = NULL,
  70.                       *TE11_ChipText           = NULL,
  71.                       *TE11_FastText           = NULL;
  72.  
  73. MODULE struct
  74. {   STRPTR friendly;
  75.     STRPTR unfriendly;
  76. } subsystems[SUBSYSTEMS + 1] =
  77. {   {"3D Look",                "new.look"        },
  78.     {"A590",                   "A2091.A590"      },
  79.     {"A2013",                  "A2013"           },
  80.     {"A2065",                  "A2065"           },
  81.     {"A2090",                  "A2090.A2090A"    },
  82.     {"A2090A",                 "A2090.A2090A"    },
  83.     {"A2091",                  "A2091"           },
  84.     {"A2232",                  "A2232"           },
  85.     {"A2300",                  "A2300"           },
  86.     {"A2410",                  "A2410"           },
  87.     {"A2620",                  "A2620"           },
  88.     {"A2630",                  "A2630"           },
  89.     {"A3000",                  "A3000"           },
  90.     {"A4091",                  "A4091"           },
  91.     {"AmigaBASIC",             "AmigaBasic"      },
  92.     {"AGA chipset",            "aa.chips"        },
  93.     {"ALink",                  "alink"           },
  94.     {"amiga.lib",              "amiga.lib"       },
  95.     {"AmigaGuide",             "amigaguide"      },
  96.     {"AmigaTerm",              "amigaterm"       },
  97.     {"AmigaVision",            "amigavision"     },
  98.     {"AppShell",               "appshell"        },
  99.     {"ARexx",                  "arexx"           },
  100.     {"Art",                    "art"             },
  101.     {"AS225",                  "as225"           },
  102.     {"ASL.library",            "asl.library"     },
  103.     {"audio.device",           "audio.device"    },
  104.     {"AUTOCONFIG",             "autoconfig"      },
  105.     {"Battery-backed clock",   "battclock"       },
  106.     {"Battery-backed memory",  "battmem"         },
  107.     {"Bootstrap",              "strap"           },
  108.     {"BridgeBoard",            "bridgeboard"     },
  109.     {"BRU",                    "bru"             },
  110.     {"bullet.library",         "bullet"          },
  111.     {"C: programs",            "cdos.command"    },
  112.     {"CD.device",              "cd.device"       },
  113.     {"CD32 hardware",          "cdgs"            },
  114.     {"CDFileSystem",           "cdfilesystem"    },
  115.     {"CDTV",                   "cdtv"            },
  116.     {"CDTV.device",            "cdtv.device"     },
  117.     {"cdui",                   "cdui"            },
  118.     {"CIA.resource",           "cia.resource"    },
  119.     {"CLI",                    "shell"           },
  120.     {"clipboard.device",       "clipboard"       },
  121.     {"Commodities",            "commodities"     },
  122.     {"CON-Handler",            "con-handler"     },
  123.     {"console.device",         "console.device"  },
  124.     {"Custom chipset",         "custom.chips"    },
  125.     {"Datatypes",              "datatypes"       },
  126.     {"debug.lib",              "debug.lib"       },
  127.     {"Developer support",      "devsupport"      },
  128.     {"disk.resource",          "disk.resource"   },
  129.     {"diskfont.library",       "diskfont"        },
  130.     {"DOS.library",            "dos.library"     },
  131.     {"Early Startup Control",  "bootmenu"        },
  132.     {"Envoy",                  "envoy"           },
  133.     {"Exec.library",           "exec"            },
  134.     {"expansion.library",      "expansion"       },
  135.     {"filesystem",             "filesystem"      },
  136.     {"filesystem.resource",    "filesysres"      },
  137.     {"Fonts",                  "fonts"           },
  138.     {"Fountain",               "fountain"        },
  139.     {"gadget.classes",         "gadget.classes"  },
  140.     {"GadTools.library",       "gadtools"        },
  141.     {"gameport.device",        "gameport"        },
  142.     {"Genlock",                "genlock"         },
  143.     {"Graphics",               "graphics"        },
  144.     {"Hardware",               "hardware"        },
  145.     {"HDBackup",               "hdbackup"        },
  146.     {"HDToolBox",              "hdtoolbox"       },
  147.     {"icon.library",           "icon.library"    },
  148.     {"IconEdit",               "iconedit"        },
  149.     {"IDE.device",             "ide.device"      },
  150.     {"IFFParse.library",       "iffparse"        },
  151.     {"input.device",           "input.device"    },
  152.     {"Installer",              "installer"       },
  153.     {"IntelliFont",            "fountain"        },
  154.     {"Intuition.library",      "intuition"       },
  155.     {"IPrefs",                 "iprefs"          },
  156.     {"Keyboard",               "keyboard"        },
  157.     {"keymap.library",         "keymap"          },
  158.     {"Keymaps",                "keymaps"         },
  159.     {"layers.library",         "layers"          },
  160.     {"locale.library",         "locale.library"  },
  161.     {"lowlevel.library",       "lowlevel"        },
  162.     {"Maths: FFP",             "mathffp"         },
  163.     {"Maths: IEEE Double Precision", "mathieeedoub"    },
  164.     {"Maths: IEEE Single Precision", "mathieeesing"    },
  165.     {"Maths: IEEE",            "mathieee"        },
  166.     {"MicroEMACS",             "microemacs"      },
  167.     {"Monitors",               "monitors"        },
  168.     {"MultiView",              "multiview"       },
  169.     {"nonvolatile",            "nonvolatile"     },
  170.     {"parallel.device",        "parallel.device" },
  171.     {"PCMCIA",                 "creditcard"      },
  172.     {"PORT-Handler",           "port-handler"    },
  173.     {"potgo.resource",         "potgo.resource"  },
  174.     {"Preferences",            "preferences"     },
  175.     {"Printer drivers",        "printer.driver"  },
  176.     {"printer.device",         "printer.device"  },
  177.     {"QUEUE-Handler",          "queue-handler"   },
  178.     {"RAM-Handler",            "ram-handler"     },
  179.     {"ramlib",                 "ramlib"          },
  180.     {"realtime",               "realtime"        },
  181.     {"Report+",                "report+"         },
  182.     {"Resources",              "resource"        },
  183.     {"ROM Kernel Manuals",     "rkm"             },
  184.     {"ROMWack",                "wack"            },
  185.     {"SANA-2",                 "sana2"           },
  186.     {"Scripts",                "script"          },
  187.     {"SCSI.device",            "scsi.device"     },
  188.     {"serial.device",          "serial.device"   },
  189.     {"Shell",                  "shell"           },
  190.     {"Startup",                "startup"         },
  191.     {"System/ programs",       "system.command"  },
  192.     {"TCP/IP",                 "as225"           },
  193.     {"timer.device",           "timer.device"    },
  194.     {"ToolMaker",              "toolmaker"       },
  195.     {"Tools/ programs",        "tools"           },
  196.     {"trackdisk.device",       "trackdisk"       },
  197.     {"UNIX",                   "unix"            },
  198.     {"Unsure",                 ""                },
  199.     {"User manuals",           "userdocs"        },
  200.     {"Utilities/ programs",    "util.command"    },
  201.     {"utility.library",        "utility.library" },
  202.     {"Wack",                   "wack"            },
  203.     {"Workbench",              "workbench"       },
  204.     {"Worm Wars",              "wormwars"        }
  205. };
  206. MODULE STRPTR TypeOptions[4] =
  207. {   "System Software/Hardware Bug",
  208.     "3rd Party Product Compatibility",
  209.     "Enhancement Request",
  210.     NULL
  211. };
  212. MODULE STRPTR SeverityOptions[5] =
  213. {   (STRPTR) "Crashes, hangs or corrupts data",
  214.     (STRPTR) "Behaves incorrectly",
  215.     (STRPTR) "Cosmetic problem",
  216.     (STRPTR) "Works correctly",
  217.     NULL
  218. };
  219. MODULE STRPTR AgnusOptions[6] =
  220. {   (STRPTR) "AGA",
  221.     (STRPTR) "ECS PAL",
  222.     (STRPTR) "ECS NTSC",
  223.     (STRPTR) "OCS PAL",
  224.     (STRPTR) "OCS NTSC",
  225.     NULL
  226. };
  227. MODULE STRPTR CPUOptions[CPUS + 2] =
  228. {   (STRPTR) "68020",
  229.     (STRPTR) "68030",
  230.     (STRPTR) "68040",
  231.     (STRPTR) "68060",
  232.     (STRPTR) "PowerPC",
  233.     NULL
  234. };
  235. MODULE STRPTR ModelOptions[MODELS + 2] =
  236. {   (STRPTR) "A500",
  237.     (STRPTR) "A500+",
  238.     (STRPTR) "A600",
  239.     (STRPTR) "A1000",
  240.     (STRPTR) "A1200",
  241.     (STRPTR) "A1500",
  242.     (STRPTR) "A2000",
  243.     (STRPTR) "A2500",
  244.     (STRPTR) "A3000",
  245.     (STRPTR) "A4000",
  246.     (STRPTR) "CDTV",
  247.     (STRPTR) "CD32",
  248.     (STRPTR) "DraCo",
  249.     (STRPTR) "Emulator",
  250.     NULL
  251. };
  252.  
  253. IMPORT ULONG               fillcolour, offset;
  254. IMPORT TEXT                aslresult[MEDFIELD + 1];
  255. IMPORT TEXT                weekdaystring[10],
  256.                            datestring[10],
  257.                            timestring[9];
  258. IMPORT struct SharedStruct shared;
  259. IMPORT struct NewGadget    Gadget;
  260. IMPORT struct Gadget      *BU99_Right,
  261.                           *GListPtr,
  262.                           *PrevGadPtr;
  263. IMPORT TEXT                IOBuffer[LONGESTFIELD + 1];
  264. IMPORT SBYTE               page;
  265. IMPORT ABOOL               certified, fillwindows;
  266. IMPORT TEXT                string[VLONGFIELD + 1];
  267. IMPORT struct Window*      MainWindowPtr;
  268. IMPORT struct Menu*        MenuPtr;
  269. IMPORT struct Screen*      ScreenPtr;
  270. IMPORT struct Library*     TextEditorBase;
  271. IMPORT Object*             WinObject[FUNCTIONS + 1];
  272. IMPORT struct VisualInfo*  VisualInfoPtr;
  273.  
  274. /* report.textfield[] are:
  275.    0: brief bug description
  276.    1: bug generation procedure or example
  277.    2: if this works differently on other versions or hardware, explain
  278.    3: what developer is doing in that area of HW or SW
  279.    4: related problems
  280.    5: enhancement request */
  281.  
  282. AGLOBAL void report1(void)
  283. {   /* PAGE 11 ************************************************************ */
  284.  
  285.     verynewwindow
  286.     (   REPORTWIDTH, REPORTHEIGHT,
  287.         "Report+: Report Details (Page 1 of 2)",
  288.         BUTTONIDCMP | LISTVIEWIDCMP | STRINGIDCMP | CYCLEIDCMP
  289.     );
  290.     if (fillwindows)
  291.     {   SetAPen(MainWindowPtr->RPort, 0);
  292.         RectFill(MainWindowPtr->RPort,  10, 158,  10 + 238, 158 + 327 - 4); // LV11_Subsystem
  293.         RectFill(MainWindowPtr->RPort, 100,  42, 100 + 284,  42 + 12);      // TE11_EMailTo
  294.     }
  295.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_NEW,    NOSUB));
  296.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_OPEN,   NOSUB));
  297.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVE,   NOSUB));
  298.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVEAS, NOSUB));
  299.  
  300.     DrawBevelBox(MainWindowPtr->RPort, 290, 248, 318, 236, GT_VisualInfo, VisualInfoPtr);
  301.     SetAPen(MainWindowPtr->RPort, BLACK);
  302.     if (fillwindows)
  303.     {   getfillcolour();
  304.         SetBPen(MainWindowPtr->RPort, fillcolour);
  305.     }
  306.     Move(MainWindowPtr->RPort, 290 + (318 / 2) - (13 * FONTX / 2), 248 + 4);
  307.     Text(MainWindowPtr->RPort, "Configuration", 13);
  308.  
  309.     /* summary */
  310.     setgadget(100, 30, 496, 12, "_Summary:", PLACETEXT_LEFT);
  311.     ST11_Summary = PrevGadPtr = (struct Gadget *) CreateGadget
  312.     (   STRING_KIND,
  313.         PrevGadPtr,
  314.         &Gadget,
  315.         STRINGA_Justification, GACT_STRINGLEFT,
  316.         GTST_String, &(report.summary),
  317.         GTST_MaxChars, LONGFIELD,
  318.         GA_TabCycle, TRUE,
  319.         GT_Underscore, '_',
  320.         TAG_DONE
  321.     );
  322.     /* email to */
  323.     setgadget(100, 42, 284, 12, "Email to:", PLACETEXT_LEFT);
  324.     TE11_EMailTo = PrevGadPtr = (struct Gadget *) CreateGadget
  325.     (   TEXT_KIND,
  326.         PrevGadPtr,
  327.         &Gadget,
  328.         GTTX_Border, TRUE,
  329.         TAG_DONE
  330.     );
  331.  
  332.     /* sender... */
  333.     setgadget(10,  106, 140, 12, "Sende_r...", NULL);
  334.     BU11_Sender = PrevGadPtr = (struct Gadget *) CreateGadget
  335.     (   BUTTON_KIND,
  336.         PrevGadPtr,
  337.         &Gadget,
  338.         GT_Underscore, '_',
  339.         TAG_DONE
  340.     );
  341.     /* text editor... */
  342.     setgadget(10, 118, 140, 12, "Other pa_ge...", NULL);
  343.     BU11_TextEditor = PrevGadPtr = (struct Gadget *) CreateGadget
  344.     (   BUTTON_KIND,
  345.         PrevGadPtr,
  346.         &Gadget,
  347.         GT_Underscore, '_',
  348.         TAG_DONE
  349.     );
  350.  
  351.     /* type */
  352.     setgadget(100, 66, 284, 12, "_Type:", PLACETEXT_LEFT);
  353.     CY11_Type = PrevGadPtr = (struct Gadget *) CreateGadget
  354.     (   CYCLE_KIND,
  355.         PrevGadPtr,
  356.         &Gadget,
  357.         GTCY_Labels, TypeOptions,
  358.         GTCY_Active, report.type,
  359.         GT_Underscore, '_',
  360.         TAG_DONE
  361.     );
  362.  
  363.     /* classification */
  364.     setgadget(100, 78, 284, 12, "Severit_y:", PLACETEXT_LEFT);
  365.     CY11_Severity = PrevGadPtr = (struct Gadget *) CreateGadget
  366.     (   CYCLE_KIND,
  367.         PrevGadPtr,
  368.         &Gadget,
  369.         GTCY_Labels, SeverityOptions,
  370.         GTCY_Active, report.severity,
  371.         GT_Underscore, '_',
  372.         TAG_DONE
  373.     );
  374.  
  375.     setgadget(10, 158, 238, 327, "Subsystem:", NULL);
  376.     LV11_Subsystem = PrevGadPtr = (struct Gadget *) CreateGadget
  377.     (   LISTVIEW_KIND,
  378.         PrevGadPtr,
  379.         &Gadget,
  380.         GTLV_Labels, &SubsystemList,
  381.         GTLV_ShowSelected, NULL,
  382.         GTLV_Selected, report.subsystem,
  383.         GT_Underscore, '_',
  384.         TAG_DONE
  385.     );
  386.  
  387.     /* 3rd party product */
  388.     setgadget(422, 190, 100, 1, "3rd Party Product:", PLACETEXT_ABOVE);
  389.     TE11_3rdLabel = PrevGadPtr = (struct Gadget *) CreateGadget
  390.     (   TEXT_KIND,
  391.         PrevGadPtr,
  392.         &Gadget,
  393.         TAG_DONE
  394.     );
  395.     /* 3rd party product name */
  396.     setgadget(400, 190, 200, 12, "N_ame:", NULL);
  397.     ST11_3rdName = PrevGadPtr = (struct Gadget *) CreateGadget
  398.     (   STRING_KIND,
  399.         PrevGadPtr,
  400.         &Gadget,
  401.         GTST_String, &(report.thirdname),
  402.         GTST_MaxChars, MEDFIELD,
  403.         GA_TabCycle, TRUE,
  404.         GT_Underscore, '_',
  405.         TAG_DONE
  406.     );
  407.     /* 3rd party product version */
  408.     setgadget(400, 202, 100, 12, "_Version:", NULL);
  409.     ST11_3rdVer = PrevGadPtr = (struct Gadget *) CreateGadget
  410.     (   STRING_KIND,
  411.         PrevGadPtr,
  412.         &Gadget,
  413.         GTST_String, &(report.thirdver),
  414.         GTST_MaxChars, MEDFIELD,
  415.         GA_TabCycle, TRUE,
  416.         GT_Underscore, '_',
  417.         TAG_DONE
  418.     );
  419.     /* 3rd party product manufacturer */
  420.     setgadget(400, 214, 200, 12, "Man_ufacturer:", NULL);
  421.     ST11_3rdManuf = PrevGadPtr = (struct Gadget *) CreateGadget
  422.     (   STRING_KIND,
  423.         PrevGadPtr,
  424.         &Gadget,
  425.         GTST_String, &(report.thirdmanuf),
  426.         GTST_MaxChars, MEDFIELD,
  427.         GA_TabCycle, TRUE,
  428.         GT_Underscore, '_',
  429.         TAG_DONE
  430.     );
  431.  
  432.     /* debug tools and wedges */
  433.     setgadget(400, 78, 196, 12, "_Debug tools and wedges:", PLACETEXT_ABOVE);
  434.     ST11_Debug = PrevGadPtr = (struct Gadget *) CreateGadget
  435.     (   STRING_KIND,
  436.         PrevGadPtr,
  437.         &Gadget,
  438.         STRINGA_Justification, GACT_STRINGLEFT,
  439.         GTST_String, &(report.debug),
  440.         GTST_MaxChars, LONGFIELD,
  441.         GA_TabCycle, TRUE,
  442.         GT_Underscore, '_',
  443.         TAG_DONE
  444.     );
  445.  
  446.     /* kickstart version */
  447.     if (report.ks[0] == 0)
  448.         if (GetVar("Kickstart", report.ks, 6, NULL) == -1)
  449.             report.ks[0] = 0;
  450.     setgadget(400, 102, 60, 12, "_Kickstart version:", NULL);
  451.     ST11_KS = PrevGadPtr = (struct Gadget *) CreateGadget
  452.     (   STRING_KIND,
  453.         PrevGadPtr,
  454.         &Gadget,
  455.         GTST_String, &(report.ks),
  456.         GTST_MaxChars, 6,
  457.         GA_TabCycle, TRUE,
  458.         GT_Underscore, '_',
  459.         STRINGA_Justification, GACT_STRINGRIGHT,
  460.         TAG_DONE
  461.     );
  462.     /* workbench version */
  463.     if (report.wb[0] == 0)
  464.         if (GetVar("Workbench", report.wb, 6, NULL) == -1)
  465.             report.wb[0] = 0;
  466.     setgadget(400, 114, 60, 12, "_Workbench version:", NULL);
  467.     ST11_WB = PrevGadPtr = (struct Gadget *) CreateGadget
  468.     (   STRING_KIND,
  469.         PrevGadPtr,
  470.         &Gadget,
  471.         GTST_String, &(report.wb),
  472.         GTST_MaxChars, 6,
  473.         GA_TabCycle, TRUE,
  474.         GT_Underscore, '_',
  475.         STRINGA_Justification, GACT_STRINGRIGHT,
  476.         TAG_DONE
  477.     );
  478.  
  479.     /* program pathname */
  480.     setgadget(400, 138, 196, 12, "P_rogram pathname:", NULL);
  481.     ST11_Pathname = PrevGadPtr = (struct Gadget *) CreateGadget
  482.     (   STRING_KIND,
  483.         PrevGadPtr,
  484.         &Gadget,
  485.         GTST_String, &(report.pp),
  486.         GTST_MaxChars, LONGFIELD,
  487.         GA_TabCycle, TRUE,
  488.         GT_Underscore, '_',
  489.         TAG_DONE
  490.     );
  491.     /* program... */
  492.     setgadget(598, 138, 28, 12, "...", NULL);
  493.     BU11_PathnameASL = PrevGadPtr = (struct Gadget *) CreateGadget
  494.     (   BUTTON_KIND,
  495.         PrevGadPtr,
  496.         &Gadget,
  497.         GT_Underscore, '_',
  498.         TAG_DONE
  499.     );
  500.     /* program version */
  501.     setgadget(400, 150, 196, 12, "Program v_ersion:", NULL);
  502.     ST11_Version = PrevGadPtr = (struct Gadget *) CreateGadget
  503.     (   STRING_KIND,
  504.         PrevGadPtr,
  505.         &Gadget,
  506.         GTST_String, &(report.pv),
  507.         GTST_MaxChars, LONGFIELD,
  508.         GA_TabCycle, TRUE,
  509.         GT_Underscore, '_',
  510.         TAG_DONE
  511.     );
  512.  
  513.     /* model */
  514.     setgadget(344, 274, 6 * FONTX, 0, "_Model:", PLACETEXT_ABOVE);
  515.     TE11_ModelText = PrevGadPtr = (struct Gadget *) CreateGadget
  516.     (   TEXT_KIND,
  517.         PrevGadPtr,
  518.         &Gadget,
  519.         GT_Underscore, '_',
  520.         TAG_DONE
  521.     );
  522.     setgadget(344, 274, 0, 0, NULL, PLACETEXT_RIGHT);
  523.     MX11_Model = PrevGadPtr = (struct Gadget *) CreateGadget
  524.     (   MX_KIND,
  525.         PrevGadPtr,
  526.         &Gadget,
  527.         GTMX_Labels, &ModelOptions,
  528.         GTMX_Active, report.model,
  529.         TAG_DONE
  530.     );
  531.     /* Agnus */
  532.     setgadget(480, 274, 13 * FONTX, 0, "Ch_ipset Type:", PLACETEXT_ABOVE);
  533.     TE11_AgnusText = PrevGadPtr = (struct Gadget *) CreateGadget
  534.     (   TEXT_KIND,
  535.     PrevGadPtr,
  536.     &Gadget,
  537.         GT_Underscore, '_',
  538.         TAG_DONE
  539.     );
  540.     setgadget(480, 274, 0, 0, NULL, PLACETEXT_RIGHT);
  541.     MX11_Agnus = PrevGadPtr = (struct Gadget *) CreateGadget
  542.     (   MX_KIND,
  543.     PrevGadPtr,
  544.     &Gadget,
  545.     GTMX_Labels, &AgnusOptions,
  546.     GTMX_Active, report.agnus,
  547.     TAG_DONE
  548.     );
  549.     /* CPU */
  550.     setgadget(480, 354, 4 * FONTX, 0, "CP_U:", PLACETEXT_ABOVE);
  551.     // extra spaces ensure consistent centring
  552.     TE11_CPUText = PrevGadPtr = (struct Gadget *) CreateGadget
  553.     (   TEXT_KIND,
  554.         PrevGadPtr,
  555.         &Gadget,
  556.         GT_Underscore, '_',
  557.         TAG_DONE
  558.     );
  559.     setgadget(480, 354, 0, 0, NULL, PLACETEXT_RIGHT);
  560.     MX11_CPU = PrevGadPtr = (struct Gadget *) CreateGadget
  561.     (   MX_KIND,
  562.         PrevGadPtr,
  563.         &Gadget,
  564.         GTMX_Labels, &CPUOptions,
  565.         GTMX_Active, report.cpu,
  566.         TAG_DONE
  567.     );
  568.     /* chip RAM */
  569.     setgadget(534, 418, 1, 12, "Mb", PLACETEXT_RIGHT);
  570.     TE11_ChipText = PrevGadPtr = (struct Gadget *) CreateGadget
  571.     (   TEXT_KIND,
  572.         PrevGadPtr,
  573.         &Gadget,
  574.         TAG_DONE
  575.     );
  576.     setgadget(476, 418, 64, 12, "_Chip RAM:", NULL);
  577.     ST11_Chip = PrevGadPtr = (struct Gadget *) CreateGadget
  578.     (   STRING_KIND,
  579.         PrevGadPtr,
  580.         &Gadget,
  581.         GTST_String, &(report.chipram),
  582.         GTST_MaxChars, 4,
  583.         GA_TabCycle, TRUE,
  584.         GT_Underscore, '_',
  585.         TAG_DONE
  586.     );
  587.     // slow/fast RAM
  588.     setgadget(534, 430, 1, 12, "Mb", PLACETEXT_RIGHT);
  589.     TE11_FastText = PrevGadPtr = (struct Gadget *) CreateGadget
  590.     (   TEXT_KIND,
  591.         PrevGadPtr,
  592.         &Gadget,
  593.         TAG_DONE
  594.     );
  595.     setgadget(476, 430, 64, 12, "Sl_ow/fast RAM:", NULL);
  596.     ST11_Fast = PrevGadPtr = (struct Gadget *) CreateGadget
  597.     (   STRING_KIND,
  598.         PrevGadPtr,
  599.         &Gadget,
  600.         GTST_String, &(report.fastram),
  601.         GTST_MaxChars, 4,
  602.         GA_TabCycle, TRUE,
  603.         GT_Underscore, '_',
  604.         TAG_DONE
  605.     );
  606.     /* floppies */
  607.     setgadget(476, 442, 64, 12, "N_umber of floppies:", NULL);
  608.     IN11_Floppies = PrevGadPtr = (struct Gadget *) CreateGadget
  609.     (   INTEGER_KIND,
  610.     PrevGadPtr,
  611.     &Gadget,
  612.     GTIN_Number, report.floppies,
  613.     GA_TabCycle, TRUE,
  614.         GT_Underscore, '_',
  615.     TAG_DONE
  616.     );
  617.     /* hard disk controller */
  618.     setgadget(476, 454, 120, 12, "_Hard disk controller:", NULL);
  619.     ST11_Hard = PrevGadPtr = (struct Gadget *) CreateGadget
  620.     (    STRING_KIND,
  621.     PrevGadPtr,
  622.     &Gadget,
  623.     GTST_String, &(report.hard),
  624.     GTST_MaxChars, MEDFIELD,
  625.     GA_TabCycle, TRUE,
  626.         GT_Underscore, '_',
  627.     TAG_DONE
  628.     );
  629.     /* expansion cards */
  630.     setgadget(476, 466, 120, 12, "E_xpansion cards:", NULL);
  631.     ST11_Expansion = PrevGadPtr = (struct Gadget *) CreateGadget
  632.     (   STRING_KIND,
  633.         PrevGadPtr,
  634.         &Gadget,
  635.     GTST_String, &(report.expansion),
  636.     GTST_MaxChars, LONGFIELD,
  637.     GA_TabCycle, TRUE,
  638.         GT_Underscore, '_',
  639.     TAG_DONE
  640.     );
  641.  
  642.     drawgadgets((UWORD) ~0);
  643.     updatereportgadgets(); // we do need this here so that gadgets are
  644.                            // ghosted as appropriate
  645.     ActivateGadget(ST11_Summary, MainWindowPtr, NULL);
  646.  
  647.     loop();
  648.     readreportgadgets();
  649.     closewindow();
  650. }
  651.  
  652. MODULE void readreportgadgets(void)
  653. {   strcpy
  654.     (   report.summary,
  655.         ((struct StringInfo *) ST11_Summary->SpecialInfo)->Buffer
  656.     );
  657.     if (report.type == COM)
  658.     {   strcpy
  659.         (   report.thirdver,
  660.             ((struct StringInfo *) ST11_3rdVer->SpecialInfo)->Buffer
  661.         );
  662.         strcpy
  663.         (   report.thirdname,
  664.             ((struct StringInfo *) ST11_3rdName->SpecialInfo)->Buffer
  665.         );
  666.         strcpy
  667.         (   report.thirdmanuf,
  668.             ((struct StringInfo *) ST11_3rdManuf->SpecialInfo)->Buffer
  669.         );
  670.     } elif (report.type == BUG)
  671.     {   strcpy
  672.         (   report.pp,
  673.             ((struct StringInfo *) ST11_Pathname->SpecialInfo)->Buffer
  674.         );
  675.         strcpy
  676.         (   report.pv,
  677.             ((struct StringInfo *) ST11_Version->SpecialInfo)->Buffer
  678.         );
  679.     }
  680.     if (report.type != ENH)
  681.     {   strcpy
  682.         (   report.ks,
  683.             ((struct StringInfo *) ST11_KS->SpecialInfo)->Buffer
  684.         );
  685.         strcpy
  686.         (   report.wb,
  687.             ((struct StringInfo *) ST11_WB->SpecialInfo)->Buffer
  688.         );
  689.         strcpy
  690.         (   report.debug,
  691.             ((struct StringInfo *) ST11_Debug->SpecialInfo)->Buffer
  692.         );
  693.     }
  694.     strcpy(report.chipram,   ((struct StringInfo *) ST11_Chip->SpecialInfo)->Buffer);
  695.     strcpy(report.fastram,   ((struct StringInfo *) ST11_Fast->SpecialInfo)->Buffer);
  696.     strcpy(report.hard,      ((struct StringInfo *) ST11_Hard->SpecialInfo)->Buffer);
  697.     report.floppies        = ((struct StringInfo *) IN11_Floppies->SpecialInfo)->LongInt;
  698.     if (report.floppies < 0)
  699.     {   report.floppies = 0;
  700.     } elif (report.floppies > 3)
  701.     {   report.floppies = 3;
  702.     }
  703.     strcpy(report.expansion, ((struct StringInfo *) ST11_Expansion->SpecialInfo)->Buffer);
  704. }
  705.  
  706. AGLOBAL void savereport(ABOOL saveas)
  707. { /*    # Subject: <subject><LF>
  708.         # Type: bug|compat|enhancement<LF>
  709. 1,3     # Subsystem: <subsystem><LF>
  710. 2       # ProductName: <name> (vers=<version>)
  711. 2       # ProductInfo: :<manufacturer>:
  712.         # Severity: a|b|c|ok|e
  713. 1       # Release: KS=<version>,WB=<version>,Program=<version>
  714. 2       # Release: KS=<version>,WB=<version>
  715.         # Date: <weekday> dd-Mon-yy hh:mm:ss
  716.         # Refer: <refer>
  717.         # Path: <path>
  718.         # ReferID: <referid>
  719.         # Config: <config>
  720. 1,2a-c    ### BRIEF BUG DESCRIPTION:
  721. 1,2a-c    ### BUG GENERATION PROCEDURE OR EXAMPLE:
  722. 1,2     ### ALSO RUNNING:
  723.         <debug>
  724. 1,2     ### IF THIS WORKS DIFFERENTLY ON OTHER VERSIONS OR HARDWARE,
  725.         EXPLAIN:
  726. 2a-c    ### WHAT DEVELOPER IS DOING IN THAT AREA OF SW OR HW:    
  727. 1,2a-c    ### RELATED PROBLEMS:
  728. 3       ### ENHANCEMENT REQUEST: */
  729.  
  730.     readreportgadgets();
  731.  
  732.     strcpy(IOBuffer, "# Subject: ");
  733.     strcat(IOBuffer, report.summary);
  734.     strcat(IOBuffer, "\n# Type: ");
  735.     if (report.type == BUG)
  736.     strcat(IOBuffer, "bug");
  737.     elif (report.type == COM)
  738.         strcat(IOBuffer, "compat");
  739.     else /* assumes (report.type == ENH) */
  740.         strcat(IOBuffer, "enhancement");
  741.     strcat(IOBuffer, "\n");
  742.     if (report.type == BUG || report.type == ENH)
  743.     {    strcat(IOBuffer, "# Subsystem: ");
  744.         strcat(IOBuffer, subsystems[report.subsystem].unfriendly);
  745.     strcat(IOBuffer, "\n");
  746.     } else
  747.     {    strcat(IOBuffer, "# ProductName: ");
  748.     strcat(IOBuffer, report.thirdname);
  749.         strcat(IOBuffer, " (vers=");
  750.         strcat(IOBuffer, report.thirdver);
  751.         strcat(IOBuffer, ")\n# ProductInfo: :");
  752.         strcat(IOBuffer, report.thirdmanuf);
  753.         strcat(IOBuffer, ":\n");
  754.     }
  755.     strcat(IOBuffer, "# Severity: ");
  756.     if (report.type == ENH)
  757.         strcat(IOBuffer, "e");
  758.     elif (report.severity == 0)
  759.         strcat(IOBuffer, "a");
  760.     elif (report.severity == 1)
  761.         strcat(IOBuffer, "b");
  762.     elif (report.severity == 2)
  763.         strcat(IOBuffer, "c");
  764.     else /* assumes report.severity == 3 */
  765.     strcat(IOBuffer, "ok");
  766.     strcat(IOBuffer, "\n");
  767.     if (report.type == BUG || report.type == COM)
  768.     {    strcat(IOBuffer, "# Release: KS=");
  769.         strcat(IOBuffer, report.ks);
  770.         strcat(IOBuffer, ",WB=");
  771.         strcat(IOBuffer, report.wb);
  772.         if (report.type == BUG)
  773.         {    strcat(IOBuffer, ",Program=");
  774.             strcat(IOBuffer, report.pv);
  775.         }
  776.         strcat(IOBuffer, "\n");
  777.     }
  778.     
  779.     getdate();
  780.     strcat(IOBuffer, "# Date: ");
  781.     strcat(IOBuffer, weekdaystring);
  782.     strcat(IOBuffer, " ");
  783.     strcat(IOBuffer, datestring);
  784.     strcat(IOBuffer, " ");
  785.     strcat(IOBuffer, timestring);
  786.     strcat(IOBuffer, "\n");
  787.     strcat(IOBuffer, report.refer);
  788.     strcat(IOBuffer, report.path);
  789.     strcat(IOBuffer, report.referid);
  790.     strcat(IOBuffer, report.config);
  791.     strcat(IOBuffer, "\n");
  792.  
  793.     if (report.type == BUG || (report.type == COM && report.severity != 3))
  794.     {   strcat
  795.         (   IOBuffer,
  796.             "### BRIEF BUG DESCRIPTION:\n"
  797.         );
  798.         strcat(IOBuffer, report.textfield[0]);
  799.         strcat
  800.         (   IOBuffer,
  801.             "\n\n### BUG GENERATION PROCEDURE OR EXAMPLE:\n"
  802.     );
  803.         strcat(IOBuffer, report.textfield[1]);
  804.         strcat(IOBuffer, "\n\n");
  805.     }
  806.     if (report.type == BUG || report.type == COM)
  807.     {   strcat(IOBuffer, "### ALSO RUNNING:\n");
  808.         strcat(IOBuffer, report.debug);
  809.         strcat
  810.         (   IOBuffer,
  811.             "\n\n### IF THIS WORKS DIFFERENTLY ON "
  812.             "OTHER VERSIONS OR HARDWARE, EXPLAIN:\n"
  813.         );
  814.         strcat(IOBuffer, report.textfield[2]);
  815.         strcat(IOBuffer, "\n\n");
  816.     }
  817.     if (report.type == COM && report.severity != 3)
  818.     {   strcat
  819.         (   IOBuffer,
  820.             "### WHAT DEVELOPER IS DOING IN THAT AREA OF HW OR SW:\n"
  821.         );
  822.         strcat(IOBuffer, report.textfield[3]);
  823.         strcat(IOBuffer, "\n\n");
  824.     }
  825.     if (report.type == BUG || (report.type == COM && report.severity != 3))
  826.     {   strcat(IOBuffer, "### RELATED PROBLEMS:\n");
  827.         strcat(IOBuffer, report.textfield[4]);
  828.         strcat(IOBuffer, "\n\n");
  829.     } elif (report.type == ENH)
  830.     {   strcat(IOBuffer, "### ENHANCEMENT REQUEST:\n");
  831.         strcat(IOBuffer, report.textfield[5]);
  832.         strcat(IOBuffer, "\n\n");
  833.     }
  834.  
  835.     if (!report.output[0] || saveas) // if we need a filename
  836.     {   if (saveasl("Save Bug Report", "~(#?.info)"))
  837.         {   strcpy(report.output, aslresult);
  838.             writeout(report.output);
  839.     }   }
  840.     else
  841.     {   writeout(report.output);
  842. }   }
  843.     
  844. AGLOBAL void report_ra_loop(ULONG gid)
  845. {   switch(gid)
  846.     {
  847.     case GID_1_BU1:
  848.         page = 11;
  849.     break;
  850.     default:
  851.     break;
  852. }   }
  853.  
  854. AGLOBAL void report_gt_loop(ULONG class, struct Gadget* addr, UWORD code, UWORD qual)
  855.     {   if (class == IDCMP_RAWKEY && report.type != COM)
  856.         {   if (qual & IEQUALIFIER_CONTROL)
  857.             {   if (code == SCAN_UP)
  858.                 {   GT_SetGadgetAttrs
  859.                     (   LV11_Subsystem,
  860.                         MainWindowPtr,
  861.                         NULL,
  862.                         GTLV_Top, 0,
  863.                         TAG_DONE
  864.                     );
  865.                 } elif (code == SCAN_DOWN)
  866.                 {   GT_SetGadgetAttrs
  867.                     (   LV11_Subsystem,
  868.                         MainWindowPtr,
  869.                         NULL,
  870.                         GTLV_Top, SUBSYSTEMS - 10 + 1,
  871.                         // this must change according to height of listview
  872.                         TAG_DONE
  873.                     );
  874.         }   }   }
  875.         elif (class == IDCMP_VANILLAKEY)
  876.         {   code = toupper(code);
  877.             switch(code)
  878.             {
  879.             case ESCAPE:
  880.                 if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  881.                 {   cleanexit(EXIT_SUCCESS);
  882.                 } else
  883.                 {   page = 0;
  884.                 }
  885.             break;
  886.             case 'A':
  887.                 if (report.type == COM)
  888.                 {   ActivateGadget(ST11_3rdName, MainWindowPtr, NULL);
  889.                 }
  890.             break;
  891.             case 'C':
  892.                 ActivateGadget(ST11_Chip, MainWindowPtr, NULL);
  893.             break;
  894.             case 'D':
  895.                 if (report.type != ENH)
  896.                 {   ActivateGadget(ST11_Debug, MainWindowPtr, NULL);
  897.                 }
  898.             break;
  899.             case 'E':
  900.                 if (report.type == BUG)
  901.                 {   ActivateGadget(ST11_Version, MainWindowPtr, NULL);
  902.                 }
  903.             break;
  904.             case 'G':
  905.                 page = 12;
  906.             break;
  907.             case 'H':
  908.                 ActivateGadget(ST11_Hard, MainWindowPtr, NULL);
  909.             break;
  910.             case 'I':
  911.                 if ((code & IEQUALIFIER_LSHIFT) || (code & IEQUALIFIER_RSHIFT))
  912.                 {   if (report.agnus == 0)
  913.                         report.agnus = 5;
  914.                     else report.agnus--;
  915.                 } else
  916.                 {   if (report.agnus == 5)
  917.                         report.agnus = 0;
  918.                     else report.agnus++;
  919.                 }
  920.                 GT_SetGadgetAttrs
  921.                 (   MX11_Agnus,
  922.                     MainWindowPtr,
  923.                     NULL,
  924.                     GTMX_Active, report.agnus,
  925.                     TAG_DONE
  926.                 );
  927.             break;
  928.             case 'K':
  929.                 if (report.type != ENH)
  930.                 {   ActivateGadget(ST11_KS, MainWindowPtr, NULL);
  931.                 }
  932.             break;
  933.             case 'M':
  934.                 if ((code & IEQUALIFIER_LSHIFT) || (code & IEQUALIFIER_RSHIFT))
  935.                 {   if (report.model == 0)
  936.                         report.model = MODELS;
  937.                     else report.model--;
  938.                 } else
  939.                 {   if (report.model == CPUS)
  940.                         report.model = 0;
  941.                     else report.model++;
  942.                 }
  943.                 GT_SetGadgetAttrs
  944.                 (   MX11_Model,
  945.                     MainWindowPtr,
  946.                     NULL,
  947.                     GTMX_Active, report.model,
  948.                     TAG_DONE
  949.                 );
  950.             break;
  951.             case 'N':
  952.                 ActivateGadget(IN11_Floppies, MainWindowPtr, NULL);
  953.             break;
  954.             case 'O':
  955.                 if (report.type == COM)
  956.                 {   ActivateGadget(ST11_3rdManuf, MainWindowPtr, NULL);
  957.                 }
  958.             break;
  959.             case 'P':
  960.                 ActivateGadget(ST11_Pathname, MainWindowPtr, NULL);
  961.             break;
  962.             case 'R':
  963.                 page = 1;
  964.             break;
  965.             case 'S':
  966.                 ActivateGadget(ST11_Summary, MainWindowPtr, NULL);
  967.             break;
  968.             case 'T':
  969.                 if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  970.                 {   if (report.type == 0)
  971.                     {   report.type = 2;
  972.                     } else report.type--;
  973.                 } else
  974.                 {   if (report.type == 2)
  975.                     {   report.type = 0;
  976.                     } else report.type++;
  977.                 }
  978.                 updatereportgadgets();
  979.             break;
  980.             case 'U':
  981.                 if ((code & IEQUALIFIER_LSHIFT) || (code & IEQUALIFIER_RSHIFT))
  982.                 {   if (report.cpu == 0)
  983.                         report.cpu = CPUS;
  984.                     else report.cpu--;
  985.                 } else
  986.                 {   if (report.cpu == CPUS)
  987.                         report.cpu = 0;
  988.                     else report.cpu++;
  989.                 }
  990.                 GT_SetGadgetAttrs
  991.                 (   MX11_CPU,
  992.                     MainWindowPtr,
  993.                     NULL,
  994.                     GTMX_Active, report.cpu,
  995.                     TAG_DONE
  996.                 );
  997.             break;
  998.             case 'V':
  999.                 if (report.type == COM)
  1000.                 {   ActivateGadget(ST11_3rdVer, MainWindowPtr, NULL);
  1001.                 }
  1002.             break;
  1003.             case 'W':
  1004.                 if (report.type != ENH)
  1005.                 {   ActivateGadget(ST11_WB, MainWindowPtr, NULL);
  1006.                 }
  1007.             break;
  1008.             case 'X':
  1009.                 ActivateGadget(ST11_Expansion, MainWindowPtr, NULL);
  1010.             break;
  1011.             case 'Y':
  1012.                 if (report.type != ENH)
  1013.                 {   if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  1014.                     {   if (report.severity == 0)
  1015.                         {   report.severity = 3;
  1016.                         } else report.severity--;
  1017.                     } else
  1018.                     {   if (report.severity == 3)
  1019.                         {   report.severity = 0;
  1020.                         } else report.severity++;
  1021.                     }
  1022.                     if (report.type == BUG && report.severity == 3)
  1023.                     {   report.severity = 0;
  1024.                     }
  1025.                     GT_SetGadgetAttrs
  1026.                     (   CY11_Severity,
  1027.                         MainWindowPtr,
  1028.                         NULL,
  1029.                         GTCY_Active, report.severity,
  1030.                         TAG_DONE
  1031.                     );
  1032.                 }
  1033.             break;
  1034.             default:
  1035.             break;
  1036.         }   }
  1037.         elif (class == IDCMP_GADGETUP)
  1038.         {   if (addr == BU11_Sender)
  1039.             {   page = 1;
  1040.             } elif (addr == BU11_TextEditor)
  1041.             {   page = 12;
  1042.             } elif (addr == CY11_Type)
  1043.             {   report.type = code;
  1044.                 updatereportgadgets();
  1045.             } elif (report.type != COM && addr == LV11_Subsystem)
  1046.             {   // code is the position within the list.
  1047.                 report.subsystem = code;
  1048.                 updateemail();
  1049.             } elif (report.type != ENH)
  1050.             {   if (addr == CY11_Severity)
  1051.                 {   report.severity = code;
  1052.                     if (report.type == BUG && report.severity == 3)
  1053.                     {   report.severity = 0;
  1054.                         GT_SetGadgetAttrs
  1055.                         (   CY11_Severity,
  1056.                             MainWindowPtr,
  1057.                             NULL,
  1058.                             GTCY_Active, report.severity,
  1059.                             TAG_DONE
  1060.                         );
  1061.                 }   }
  1062.                 elif (report.type == BUG)
  1063.                 {   if (addr == ST11_Pathname)
  1064.                     {   refreshpv();
  1065.                     } elif (addr == BU11_PathnameASL)
  1066.                     {   if (asl("~(#?.info)"))
  1067.                         {   GT_SetGadgetAttrs
  1068.                             (   ST11_Pathname,
  1069.                                 MainWindowPtr,
  1070.                                 NULL,
  1071.                                 GTST_String, aslresult,
  1072.                                 TAG_DONE
  1073.                             );
  1074.                             refreshpv();
  1075.         }   }   }   }   }
  1076.         elif (class == IDCMP_GADGETDOWN)
  1077.         {   if (addr == MX11_Model)
  1078.                 report.model = code;
  1079.             elif (addr == MX11_CPU)
  1080.                 report.cpu = code;
  1081.             elif (addr == MX11_Agnus)
  1082.             {   report.agnus = code;
  1083.     }   }   }
  1084.  
  1085. MODULE void refreshpv(void)
  1086. {       ULONG   i;
  1087.     BPTR    FileHandle;
  1088.  
  1089.         strcpy(string, "Version ");
  1090.     strcat
  1091.     (   string,
  1092.             ((struct StringInfo *) ST11_Pathname->SpecialInfo)->Buffer
  1093.     );
  1094.         if (!(FileHandle = (BPTR) Open("T:ReportPlus.temp", MODE_NEWFILE)))
  1095.         rq("Can't open T:ReportPlus.temp for writing!");
  1096.     if (!Execute(string, NULL, FileHandle))
  1097.             rq("Can't execute Version!");
  1098.     if (!Close(FileHandle))
  1099.         rq("Can't close T:ReportPlus.temp for writing!");
  1100.  
  1101.         readordie("T:ReportPlus.temp");
  1102.  
  1103.     DeleteFile("T:ReportPlus.temp"); /* returns FALSE for failure */
  1104.     for (i = 0; i <= MEDFIELD; i++)
  1105.             if (IOBuffer[i] == LF)
  1106.             {   IOBuffer[i] = 0;
  1107.                 break;
  1108.             }
  1109.     GT_SetGadgetAttrs
  1110.         (   ST11_Version,
  1111.         MainWindowPtr,
  1112.         NULL,
  1113.         GTST_String, IOBuffer,
  1114.         TAG_DONE
  1115.     );
  1116. }
  1117.  
  1118. AGLOBAL void report_die(void)
  1119. {   if (SubsystemNodes)
  1120.     {   FreeNameNodes(&SubsystemList);
  1121.         SubsystemNodes = FALSE;
  1122. }   }
  1123.  
  1124. AGLOBAL void report_init(void)
  1125. {   ULONG i;
  1126.  
  1127.     NewList(&SubsystemList);
  1128.     for (i = 0; i <= SUBSYSTEMS; i++)
  1129.         AddNameToTail(&SubsystemList, subsystems[i].friendly);
  1130.     SubsystemNodes = TRUE;
  1131.  
  1132.     newreport(FALSE);
  1133. }
  1134.     
  1135. MODULE void updatereportgadgets(void)
  1136. {   // the following command is only needed when New or Open... is the
  1137.     // cause of the update.
  1138.     GT_SetGadgetAttrs
  1139.     (   ST11_Summary,
  1140.         MainWindowPtr,
  1141.         NULL,
  1142.         GTST_String, &(report.summary),
  1143.         TAG_DONE
  1144.     );
  1145.  
  1146.     if (report.type == BUG && report.severity == 3)
  1147.     {   report.severity = 0;
  1148.     }
  1149.  
  1150.     GT_SetGadgetAttrs
  1151.     (   CY11_Type,
  1152.         MainWindowPtr,
  1153.         NULL,
  1154.         GTCY_Active, report.type,
  1155.         TAG_DONE
  1156.     );
  1157.     GT_SetGadgetAttrs
  1158.     (   LV11_Subsystem,
  1159.         MainWindowPtr,
  1160.         NULL,
  1161.         GTLV_Selected, report.subsystem,
  1162.         TAG_DONE
  1163.     );
  1164.  
  1165.     updateemail();
  1166.  
  1167.     if (report.type == BUG)
  1168.     {   GT_SetGadgetAttrs
  1169.         (   ST11_Pathname,
  1170.             MainWindowPtr,
  1171.             NULL,
  1172.             GTST_String, report.pp,
  1173.             GA_Disabled, FALSE,
  1174.             TAG_DONE
  1175.         );
  1176.         GT_SetGadgetAttrs
  1177.         (   BU11_PathnameASL,
  1178.             MainWindowPtr,
  1179.             NULL,
  1180.             GA_Disabled, FALSE,
  1181.             TAG_DONE
  1182.         );
  1183.         GT_SetGadgetAttrs
  1184.         (   ST11_Version,
  1185.             MainWindowPtr,
  1186.             NULL,
  1187.             GTST_String, report.pv,
  1188.             GA_Disabled, FALSE,
  1189.             TAG_DONE
  1190.         );
  1191.     } else
  1192.     {   GT_SetGadgetAttrs
  1193.         (   ST11_Pathname,
  1194.             MainWindowPtr,
  1195.             NULL,
  1196.             GTST_String, report.pp,
  1197.             GA_Disabled, TRUE,
  1198.             TAG_DONE
  1199.         );
  1200.         GT_SetGadgetAttrs
  1201.         (   BU11_PathnameASL,
  1202.             MainWindowPtr,
  1203.             NULL,
  1204.             GA_Disabled, TRUE,
  1205.             TAG_DONE
  1206.         );
  1207.         GT_SetGadgetAttrs
  1208.         (   ST11_Version,
  1209.             MainWindowPtr,
  1210.             NULL,
  1211.             GTST_String, report.pv,
  1212.             GA_Disabled, TRUE,
  1213.             TAG_DONE
  1214.         );
  1215.     }
  1216.     if (report.type == COM)
  1217.     {   GT_SetGadgetAttrs
  1218.         (   LV11_Subsystem,
  1219.             MainWindowPtr,
  1220.             NULL,
  1221.             GA_Disabled, TRUE,
  1222.             TAG_DONE
  1223.         );
  1224.         GT_SetGadgetAttrs
  1225.         (   ST11_3rdName,
  1226.             MainWindowPtr,
  1227.             NULL,
  1228.             GTST_String, report.thirdname,
  1229.             GA_Disabled, FALSE,
  1230.             TAG_DONE
  1231.         );
  1232.         GT_SetGadgetAttrs
  1233.         (   ST11_3rdVer,
  1234.             MainWindowPtr,
  1235.             NULL,
  1236.             GTST_String, report.thirdver,
  1237.             GA_Disabled, FALSE,
  1238.             TAG_DONE
  1239.         );
  1240.         GT_SetGadgetAttrs
  1241.         (   ST11_3rdManuf,
  1242.             MainWindowPtr,
  1243.             NULL,
  1244.             GTST_String, report.thirdmanuf,
  1245.             GA_Disabled, FALSE,
  1246.             TAG_DONE
  1247.         );
  1248.     } else
  1249.     {   GT_SetGadgetAttrs
  1250.         (   LV11_Subsystem,
  1251.             MainWindowPtr,
  1252.             NULL,
  1253.             GA_Disabled, FALSE,
  1254.             TAG_DONE
  1255.         );
  1256.         GT_SetGadgetAttrs
  1257.         (   ST11_3rdName,
  1258.             MainWindowPtr,
  1259.             NULL,
  1260.             GTST_String, report.thirdname,
  1261.             GA_Disabled, TRUE,
  1262.             TAG_DONE
  1263.         );
  1264.         GT_SetGadgetAttrs
  1265.         (   ST11_3rdVer,
  1266.             MainWindowPtr,
  1267.             NULL,
  1268.             GTST_String, report.thirdver,
  1269.             GA_Disabled, TRUE,
  1270.             TAG_DONE
  1271.         );
  1272.         GT_SetGadgetAttrs
  1273.         (   ST11_3rdManuf,
  1274.             MainWindowPtr,
  1275.             NULL,
  1276.             GTST_String, report.thirdmanuf,
  1277.             GA_Disabled, TRUE,
  1278.             TAG_DONE
  1279.         );
  1280.     }
  1281.     if (report.type == ENH)
  1282.     {   GT_SetGadgetAttrs
  1283.         (   ST11_Debug,
  1284.             MainWindowPtr,
  1285.             NULL,
  1286.             GTST_String, report.debug,
  1287.             GA_Disabled, TRUE,
  1288.             TAG_DONE
  1289.         );
  1290.         GT_SetGadgetAttrs
  1291.         (   CY11_Severity,
  1292.             MainWindowPtr,
  1293.             NULL,
  1294.             GA_Disabled, TRUE,
  1295.             GTCY_Active, report.severity,
  1296.             TAG_DONE
  1297.         );
  1298.         GT_SetGadgetAttrs
  1299.         (   ST11_KS,
  1300.             MainWindowPtr,
  1301.             NULL,
  1302.             GTST_String, report.ks,
  1303.             GA_Disabled, TRUE,
  1304.             TAG_DONE
  1305.         );
  1306.         GT_SetGadgetAttrs
  1307.         (   ST11_WB,
  1308.             MainWindowPtr,
  1309.             NULL,
  1310.             GTST_String, report.wb,
  1311.             GA_Disabled, TRUE,
  1312.             TAG_DONE
  1313.         );
  1314.     } else
  1315.     {   GT_SetGadgetAttrs
  1316.         (   ST11_Debug,
  1317.             MainWindowPtr,
  1318.             NULL,
  1319.             GTST_String, report.debug,
  1320.             GA_Disabled, FALSE,
  1321.             TAG_DONE
  1322.         );
  1323.         GT_SetGadgetAttrs
  1324.         (   CY11_Severity,
  1325.             MainWindowPtr,
  1326.             NULL,
  1327.             GA_Disabled, FALSE,
  1328.             GTCY_Active, report.severity,
  1329.             TAG_DONE
  1330.         );
  1331.         GT_SetGadgetAttrs
  1332.         (   ST11_KS,
  1333.             MainWindowPtr,
  1334.             NULL,
  1335.             GTST_String, report.ks,
  1336.             GA_Disabled, FALSE,
  1337.             TAG_DONE
  1338.         );
  1339.         GT_SetGadgetAttrs
  1340.         (   ST11_WB,
  1341.             MainWindowPtr,
  1342.             NULL,
  1343.             GTST_String, report.wb,
  1344.             GA_Disabled, FALSE,
  1345.             TAG_DONE
  1346.         );
  1347. }   }
  1348.  
  1349. AGLOBAL void newreport(ABOOL display)
  1350. {   ULONG i;
  1351.  
  1352.     report.floppies  = 1;
  1353.     report.agnus     = 0;
  1354.     report.cpu       = 2;
  1355.     report.model     = 4;
  1356.     report.type      = 0;
  1357.     report.severity  = 0;
  1358.     report.subsystem = 0;
  1359.     strcpy(report.chipram,    "2");
  1360.     strcpy(report.fastram,    "6");
  1361.     strcpy(report.hard,       "");
  1362.     strcpy(report.debug,      "");
  1363.     strcpy(report.developer,  "");
  1364.     strcpy(report.expansion,  "");
  1365.     strcpy(report.summary,    "");
  1366.     if (GetVar("Kickstart", report.ks, 6, NULL) == -1)
  1367.         report.ks[0] = 0;
  1368.     if (GetVar("Workbench", report.wb, 6, NULL) == -1)
  1369.         report.wb[0] = 0;
  1370.     strcpy(report.pv,         "");
  1371.     strcpy(report.pp,         "");
  1372.     strcpy(report.thirdname,  "");
  1373.     strcpy(report.thirdver,   "");
  1374.     strcpy(report.thirdmanuf, "");
  1375.     strcpy(report.lastname,   "");
  1376.     strcpy(report.firstname,  "");
  1377.     strcpy(report.company,    "");
  1378.     strcpy(report.phone,      "");
  1379.     strcpy(report.email,      "");
  1380.     strcpy(report.refer,      "");
  1381.     strcpy(report.referid,    "");
  1382.     strcpy(report.path,       "");
  1383.     strcpy(report.config,     "");
  1384.     strcpy(report.output,     "");
  1385.     for (i = 0; i <= 5; i++)
  1386.     {   report.textfield[i][0] = 0;
  1387.     }
  1388.  
  1389.     /* Quicker than strcpy(report.foo, ""); is report.foo[0] = 0;
  1390.  
  1391.     Consider linking bug report generator with ID database to
  1392.     automatically generate the list of expansion cards. */
  1393.  
  1394.     if (display)
  1395.     {   updatereportgadgets();
  1396. }   }
  1397.  
  1398. AGLOBAL void openreport(void)
  1399. {   if (asl("~(#?.info)"))
  1400.     {   strcpy(report.output, aslresult);
  1401.         loadreport();
  1402.         if (page == 11)
  1403.         {   updatereportgadgets();
  1404. }   }   }
  1405.  
  1406. AGLOBAL void loadreport(void)
  1407. {   ULONG i;
  1408.  
  1409.     /* parse() returns when it has moved along and found the specified
  1410.        `ending string'. The contents, since last parse(), before the
  1411.        `ending string' are returned in string. */
  1412.  
  1413.     if (readin(report.output))
  1414.     {   offset = 0;
  1415.         parse("# Subject: ");           // skip '# Subject: '
  1416.         parse("\n# Type: ");            // goto end of '\n# Type: '
  1417.         strcpy(report.summary, string);
  1418.         parse("\n# ");
  1419.         if (!strcmp(string, "bug"))
  1420.         {   report.type = BUG;
  1421.         } elif (!strcmp(string, "compat"))
  1422.         {   report.type = COM;
  1423.         } elif (!strcmp(string, "enhancement"))
  1424.         {   report.type = ENH;
  1425.         }
  1426.         if (report.type != COM)
  1427.         {   parse("Subsystem: ");
  1428.             parse("\n");
  1429.             for (i = 0; i <= SUBSYSTEMS; i++)
  1430.             {   if (!strcmp(string, subsystems[i].unfriendly))
  1431.                 {   report.subsystem = i;
  1432.                     break;
  1433.         }   }   }
  1434.         else
  1435.         {   parse("ProductName: ");
  1436.             parse(" (vers=");
  1437.             strcpy(report.thirdname,  string);
  1438.             parse(")\n# ProductInfo: :");
  1439.             strcpy(report.thirdver,   string);
  1440.             parse(":\n");
  1441.             strcpy(report.thirdmanuf, string);
  1442.         }
  1443.         parse("# Severity: ");
  1444.         parse("\n# ");
  1445.         if (!strcmp(string, "a"))
  1446.         {   report.severity = 0;
  1447.         } elif (!strcmp(string, "b"))
  1448.         {   report.severity = 1;
  1449.         } elif (!strcmp(string, "c"))
  1450.         {   report.severity = 2;
  1451.         } elif (!strcmp(string, "ok"))
  1452.         {   report.severity = 3;
  1453.         } elif (!strcmp(string, "e"))
  1454.         {   report.type     = ENH;
  1455.         }
  1456.  
  1457.         if (report.type != ENH)
  1458.         {   parse("Release: KS=");
  1459.             parse(",WB=");
  1460.             strcpy(report.ks, string);
  1461.             if (report.type == BUG)
  1462.             {   parse(",Program=");
  1463.                 strcpy(report.wb, string);
  1464.                 parse("\n");
  1465.                 strcpy(report.pv, string);
  1466.             } else
  1467.             {   // assert(report.type == COM);
  1468.                 parse("\n");
  1469.                 strcpy(report.wb, string);
  1470.                 report.pv[0] = 0;
  1471.             }
  1472.         } else report.pv[0] = 0;
  1473.         parse("# Date: ");
  1474.  
  1475.         // now sender fields
  1476.         parse("# Refer: ");
  1477.         parse(",");
  1478.         strcpy(report.lastname, string);
  1479.         parse(" (");
  1480.         strcpy(report.firstname, string);
  1481.         parse(" ,phone ");
  1482.         strcpy(report.company, string);
  1483.         parse(")\n# Path: ");
  1484.         strcpy(report.phone, string);
  1485.         parse("\n# ReferID: ");
  1486.         strcpy(report.email, string);
  1487.         parse("\n");
  1488.         strcpy(report.developer, string);
  1489.  
  1490.         // now config fields
  1491.         parse("# Config: ");
  1492.     parse(",");
  1493.     report.model = 4;
  1494.     for (i = 0; i <= MODELS; i++)
  1495.     {   if (!stricmp(string, ModelOptions[i]))
  1496.         {   report.model = i;
  1497.                 break; // for speed
  1498.     }   }
  1499.         parse(",A=");
  1500.         report.cpu = 0;
  1501.     for (i = 0; i <= CPUS; i++)
  1502.     {   if (!stricmp(string, CPUOptions[i]))
  1503.         {   report.cpu = i;
  1504.                 break; // for speed
  1505.         }   }
  1506.  
  1507.     parse(",D=");
  1508.     if (!stricmp(string, "AA"))
  1509.         report.agnus = 0;
  1510.     elif (!stricmp(string, "ECS-pal"))
  1511.         report.agnus = 1;
  1512.     elif (!stricmp(string, "ECS"))
  1513.         report.agnus = 2;
  1514.     elif (!stricmp(string, "old-pal"))
  1515.         report.agnus = 3;
  1516.     else /* if (!stricmp(string, "old")) */
  1517.         report.agnus = 4;
  1518.  
  1519.     parse(",RAM=");
  1520.         // We will have here "AA", "ECS" or "old", but we don't use this.
  1521.  
  1522.     parse("megC/");
  1523.     strcpy(report.chipram, string);
  1524.  
  1525.     parse("megF,TD=");
  1526.     strcpy(report.fastram, string);
  1527.  
  1528.     parse(",HD=");
  1529.     report.floppies = atol(string);
  1530.  
  1531.     parse(",");
  1532.     strcpy(report.hard, string);
  1533.  
  1534.     parse("\n");
  1535.         strcpy(report.expansion, string);
  1536.  
  1537.         report.pp[0] = 0;
  1538.  
  1539.         if (report.type == BUG)
  1540.         {   parse("### BRIEF BUG DESCRIPTION:\n");
  1541.             parse("\n### BUG GENERATION PROCEDURE OR EXAMPLE:\n");
  1542.             strcpy(report.textfield[0], string);     // bug description
  1543.             parse("\n### ALSO RUNNING:\n");
  1544.             strcpy(report.textfield[1], string);     // bug procedure
  1545.             parse("\n### IF THIS WORKS DIFFERENTLY ON OTHER VERSIONS "
  1546.                   "OR HARDWARE, EXPLAIN:\n");
  1547.             strcpy(report.debug, string);            // also running
  1548.             parse("\n### RELATED PROBLEMS:\n");
  1549.             strcpy(report.textfield[2], string);     // explain differently
  1550.             parsetoend();
  1551.             strcpy(report.textfield[3], string);     // related problems
  1552.         } elif (report.type == COM)
  1553.         {   if (report.severity != 3)
  1554.             {   parse("### BRIEF BUG DESCRIPTION:\n");
  1555.                 parse("\n### BUG GENERATION PROCEDURE OR EXAMPLE:\n");
  1556.                 strcpy(report.textfield[0], string); // bug description
  1557.                 parse("\n### ALSO RUNNING:\n");
  1558.                 strcpy(report.textfield[1], string); // bug procedure
  1559.                 parse("\n### IF THIS WORKS DIFFERENTLY ON OTHER VERSIONS "
  1560.                       "OR HARDWARE, EXPLAIN:\n");
  1561.                 strcpy(report.debug, string);        // also running
  1562.                 parse("\n### WHAT DEVELOPER IS DOING IN THAT AREA OF SW "
  1563.                       "OR HW:\n");
  1564.                 strcpy(report.textfield[2], string); // explain differently
  1565.                 parse("\n### RELATED PROBLEMS:\n");
  1566.                 strcpy(report.textfield[3], string); // what doing?
  1567.                 parsetoend();
  1568.                 strcpy(report.textfield[4], string); // related problems
  1569.             } else
  1570.             {   parse("### BRIEF BUG DESCRIPTION:\n");
  1571.                 parse("\n### BUG GENERATION PROCEDURE OR EXAMPLE:\n");
  1572.                 strcpy(report.textfield[0], string); // bug description
  1573.                 parse("\n### WHAT DEVELOPER IS DOING IN THAT AREA OF SW "
  1574.                       "OR HW:\n");
  1575.                 strcpy(report.textfield[1], string); // explain differently
  1576.                 parse("\n### RELATED PROBLEMS:\n");
  1577.                 strcpy(report.textfield[2], string); // what doing?
  1578.                 parsetoend();
  1579.                 strcpy(report.textfield[3], string); // related problems
  1580.         }   }
  1581.         else
  1582.         {   // assert(report.type == ENH);
  1583.             parse("### ENHANCEMENT REQUEST:\n");
  1584.             parsetoend();
  1585.             strcpy(report.textfield[0], string);
  1586.         }
  1587.         updatereportgadgets();
  1588. }   }
  1589.  
  1590. /*          # Subject: <subject><LF>
  1591.             # Type: bug|compat|enhancement<LF>
  1592. BUG,ENH     # Subsystem: <subsystem><LF>
  1593. COM         # ProductName: <name> (vers=<version>)
  1594. COM         # ProductInfo: :<manufacturer>:
  1595.             # Severity: a|b|c|ok|e
  1596. BUG         # Release: KS=<version>,WB=<version>,Program=<version>
  1597. COM         # Release: KS=<version>,WB=<version>
  1598.             # Date: <weekday> dd-Mon-yy hh:mm:ss
  1599.             # Refer: <refer>
  1600.             # Path: <path>
  1601.             # ReferID: <referid>
  1602.             # Config: <config>
  1603. BUG,COMa-c  ### BRIEF BUG DESCRIPTION:
  1604. BUG,COMa-c  ### BUG GENERATION PROCEDURE OR EXAMPLE:
  1605. BUG,COM     ### ALSO RUNNING:
  1606.             <debug>
  1607. BUG,COM     ### IF THIS WORKS DIFFERENTLY ON OTHER VERSIONS OR HARDWARE,
  1608.             EXPLAIN:
  1609. COMa-c        ### WHAT DEVELOPER IS DOING IN THAT AREA OF SW OR HW:    
  1610. BUG,COMa-c  ### RELATED PROBLEMS:
  1611. ENH         ### ENHANCEMENT REQUEST: */
  1612.  
  1613. AGLOBAL void report2(void)
  1614. {   struct Hook    Hook1Struct;
  1615.     STRPTR         textBuffer[MAXELEMENTS_1 + 1];
  1616.     TEXT           GadTitle[MAXELEMENTS_1 + 1][VLONGFIELD + 1];
  1617.     ULONG          i, counter, elements;
  1618.     struct TagItem tag_texteditor[4] =
  1619.     { { GA_ID,                    NULL                  }, // ti_Data filled later
  1620.       { GA_RelVerify,             TRUE                  },
  1621.       { GA_TEXTEDITOR_ExportWrap, 75                    },
  1622.       { TAG_END,                  NULL                  }
  1623.     }, tag_subcaption[3] =
  1624.     { { LABEL_Text,               NULL                  }, // ti_Data filled later
  1625.       { LABEL_Justification,      LJ_CENTRE             },
  1626.       { TAG_END,                  NULL                  }
  1627.     }, tag_button[4] =
  1628.     { { GA_ID,                    GID_1_BU1             },
  1629.       { GA_RelVerify,             TRUE                  },
  1630.       { GA_Text,                  (ULONG) "_Other page" },
  1631.       { TAG_END,                  NULL                  }
  1632.     }, tag_supercaption[7] =
  1633.     { { LAYOUT_Orientation,       LAYOUT_ORIENT_VERT    },
  1634.       { LAYOUT_SpaceOuter,        TRUE                  },
  1635.       { LAYOUT_VertAlignment,     LALIGN_CENTER         },
  1636.       { LAYOUT_HorizAlignment,    LALIGN_CENTER         },
  1637.       { LAYOUT_BevelStyle,        BVS_NONE              },
  1638.       { LAYOUT_AddImage,          NULL                  }, // ti_Data filled later
  1639.       { TAG_END,                  NULL                  }
  1640.     }, tag_onlylayout[19] =
  1641.     { { LAYOUT_Orientation,       LAYOUT_ORIENT_VERT    },
  1642.       { LAYOUT_SpaceOuter,        TRUE                  },
  1643.       { LAYOUT_DeferLayout,       TRUE                  },
  1644.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1645.       { CHILD_WeightedHeight,     0                     },
  1646.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1647.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1648.       { CHILD_WeightedHeight,     0                     },
  1649.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1650.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1651.       { CHILD_WeightedHeight,     0                     },
  1652.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1653.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1654.       { CHILD_WeightedHeight,     0                     },
  1655.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1656.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1657.       { CHILD_WeightedHeight,     0                     },
  1658.       { LAYOUT_AddChild,          NULL                  }, // ti_Data filled later
  1659.       { TAG_END,                  NULL                  }
  1660.     }, tag_rootlayout[8] =
  1661.     { { LAYOUT_Orientation,    LAYOUT_ORIENT_VERT    },
  1662.       { LAYOUT_SpaceOuter,     TRUE                  },
  1663.       { LAYOUT_DeferLayout,    TRUE                  },
  1664.       { LAYOUT_AddChild,       NULL                  }, // ti_Data filled later
  1665.       { CHILD_WeightedHeight,  100,                  },
  1666.       { LAYOUT_AddChild,       NULL                  }, // ti_Data filled later
  1667.       { CHILD_WeightedHeight,  0                     },
  1668.       { TAG_END,               NULL                  }
  1669.     }, tag_window[15] =
  1670.     { { WA_PubScreen,          NULL                                            }, // ti_Data filled later
  1671.       { WA_ScreenTitle,        (ULONG) "Report+"                               },
  1672.       { WA_Title,              (ULONG) "Report+: Report Details (Page 2 of 2)" },
  1673.       { WA_Activate,           TRUE                  },
  1674.       { WA_DepthGadget,        TRUE                  },
  1675.       { WA_DragBar,            TRUE                  },
  1676.       { WA_CloseGadget,        TRUE                  },
  1677.       { WA_SizeGadget,         TRUE                  },
  1678.       { WA_IDCMP,              IDCMP_RAWKEY          },
  1679.       { WINDOW_IDCMPHook,      NULL                  }, // ti_Data filled later
  1680.       { WINDOW_IDCMPHookBits,  IDCMP_RAWKEY          },
  1681.       { WINDOW_MenuStrip,      NULL                  }, // ti_Data filled later
  1682.       { WINDOW_Position,       WPOS_FULLSCREEN       },
  1683.       { WINDOW_ParentGroup,    NULL                  }, // ti_Data filled later
  1684.       { TAG_END,               NULL                  }
  1685.     };
  1686.  
  1687.     switch(report.type)
  1688.     {
  1689.     case BUG:
  1690.         strcpy(GadTitle[0], "Brief bug _description:");
  1691.         strcpy(GadTitle[1], "_Bug generation procedure or example:");
  1692.         strcpy(GadTitle[2], "_If this works differently on other versions or hardware, explain:");
  1693.         strcpy(GadTitle[3], "_Related problems:");
  1694.         elements = 3;
  1695.     break;
  1696.     case COM:
  1697.         if (report.severity == 3)
  1698.         {   strcpy(GadTitle[0], "_If this works differently on other versions or hardware, explain:");
  1699.             elements = 0;
  1700.         } else
  1701.         {   strcpy(GadTitle[0], "Brief bug _description:");
  1702.             strcpy(GadTitle[1], "_Bug generation procedure or example:");
  1703.             strcpy(GadTitle[2], "_If this works differently on other versions or hardware, explain:");
  1704.             strcpy(GadTitle[3], "_What developer is doing in that area of software or hardware:");
  1705.             strcpy(GadTitle[4], "_Related problems:");
  1706.             elements = 4;
  1707.         }
  1708.         break;
  1709.     case ENH:
  1710.         strcpy(GadTitle[0], "_Enhancement request:");
  1711.         elements = 0;
  1712.     break;
  1713.     default:
  1714.     break;
  1715.     }
  1716.  
  1717.     /* window
  1718.         root-layout
  1719.          only-layout
  1720.           super-caption
  1721.            sub-caption
  1722.           texteditor
  1723.          button
  1724.          button */
  1725.  
  1726.     counter = 3;
  1727.     for (i = 0; i <= elements; i++)
  1728.     {   tag_subcaption[0].ti_Data          = (ULONG) GadTitle[i];
  1729.         tag_texteditor[0].ti_Data          = GID_1_TE1 + i;
  1730.         tag_supercaption[5].ti_Data        = (ULONG) NewObjectA(LABEL_GetClass(),      NULL, tag_subcaption);
  1731.         tag_onlylayout[counter].ti_Data    = (ULONG) NewObjectA(LAYOUT_GetClass(),     NULL, tag_supercaption);
  1732.         counter += 2;
  1733.         tag_onlylayout[counter].ti_Data    =
  1734.         report_gadgets[GID_1_TE1 + i]      = (ULONG) NewObjectA(TEXTEDITOR_GetClass(), NULL, tag_texteditor);
  1735.         counter++;
  1736.     }
  1737.     tag_onlylayout[counter].ti_Tag         = TAG_END;
  1738.  
  1739.     tag_rootlayout[3].ti_Data   = (ULONG) NewObjectA(LAYOUT_GetClass(), NULL,            tag_onlylayout);
  1740.     tag_rootlayout[5].ti_Data   =
  1741.     report_gadgets[GID_1_BU1]   = (ULONG) NewObjectA(NULL,              "button.gadget", tag_button);
  1742.  
  1743.     tag_window[13].ti_Data      =
  1744.     report_gadgets[GID_1_LY1]   = (ULONG) NewObjectA(LAYOUT_GetClass(), NULL,            tag_rootlayout);
  1745.  
  1746.     InitHook(&Hook1Struct, Hook1Func, NULL);
  1747.     tag_window[9].ti_Data       = &Hook1Struct;
  1748.     lockscreen();
  1749.     tag_window[0].ti_Data       = (ULONG) ScreenPtr;
  1750.     gadtools();
  1751.     tag_window[11].ti_Data      = MenuPtr;
  1752.     WinObject[1]                = (ULONG) NewObjectA(WINDOW_GetClass(), NULL,             tag_window);
  1753.     unlockscreen();
  1754.     if (!WinObject[1]) // Object creation successful?
  1755.     {   rq("Can't create ReAction objects!");
  1756.     }
  1757.     openwindow();
  1758.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVE,   NOSUB));
  1759.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVEAS, NOSUB));
  1760.  
  1761.     // Do any necessary imports.
  1762.     switch(report.type)
  1763.     {
  1764.     case BUG:
  1765.         SetGadgetAttrs
  1766.         (   report_gadgets[GID_1_TE1], MainWindowPtr, NULL,
  1767.             GA_TEXTEDITOR_Contents,    report.textfield[0]
  1768.         );
  1769.         SetGadgetAttrs
  1770.         (   report_gadgets[GID_1_TE2], MainWindowPtr, NULL,
  1771.             GA_TEXTEDITOR_Contents,    report.textfield[1]
  1772.         );
  1773.         SetGadgetAttrs
  1774.         (   report_gadgets[GID_1_TE3], MainWindowPtr, NULL,
  1775.             GA_TEXTEDITOR_Contents,    report.textfield[2]
  1776.         );
  1777.         SetGadgetAttrs
  1778.         (   report_gadgets[GID_1_TE4], MainWindowPtr, NULL,
  1779.             GA_TEXTEDITOR_Contents,    report.textfield[4]
  1780.         );
  1781.     break;
  1782.     case COM:
  1783.         if (report.severity == 3)
  1784.         {   SetGadgetAttrs
  1785.             (   report_gadgets[GID_1_TE1],         MainWindowPtr, NULL,
  1786.                 GA_TEXTEDITOR_Contents,            report.textfield[2]
  1787.             ); // if this works differently...
  1788.         } else
  1789.         {   for (i = 0; i <= 4; i++)
  1790.             {   SetGadgetAttrs
  1791.                 (   report_gadgets[GID_1_TE1 + i], MainWindowPtr, NULL,
  1792.                     GA_TEXTEDITOR_Contents,        report.textfield[i]
  1793.                 );
  1794.         }   }
  1795.     break;
  1796.     case ENH:
  1797.         SetGadgetAttrs
  1798.         (   report_gadgets[GID_1_TE1], MainWindowPtr, NULL,
  1799.             GA_TEXTEDITOR_Contents,    report.textfield[5]
  1800.         ); // enhancement request
  1801.     break;
  1802.     default:
  1803.         ; // assert(0);
  1804.     break;
  1805.     }
  1806.  
  1807.     /* 0: brief bug description
  1808.        1: bug generation procedure or example
  1809.        2: if this works differently...
  1810.        3: what developer is doing...
  1811.        4: related problems
  1812.        5: enhancement request */
  1813.  
  1814.     ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE1]);
  1815.     loop();
  1816.  
  1817.     for (i = 0; i <= elements; i++)
  1818.     {   textBuffer[i] = (STRPTR) DoGadgetMethod(report_gadgets[GID_1_TE1 + i], MainWindowPtr, NULL, GM_TEXTEDITOR_ExportText, NULL);
  1819.     }
  1820.     switch(report.type)
  1821.     {
  1822.     case BUG:
  1823.         strcpy(report.textfield[0], textBuffer[0]); // brief bug description
  1824.         strcpy(report.textfield[1], textBuffer[1]); // bug generation procedure or example
  1825.         strcpy(report.textfield[2], textBuffer[2]); // if this works differently...
  1826.         strcpy(report.textfield[4], textBuffer[3]); // related problems
  1827.     break;
  1828.     case COM:
  1829.         if (report.severity == 3)
  1830.         {   strcpy(report.textfield[2], textBuffer[0]); // if this works differently...
  1831.         } else
  1832.         {   strcpy(report.textfield[0], textBuffer[0]); // brief bug description
  1833.             strcpy(report.textfield[1], textBuffer[1]); // bug generation procedure or example
  1834.             strcpy(report.textfield[2], textBuffer[2]); // if this works differently...
  1835.             strcpy(report.textfield[3], textBuffer[3]); // what developer is doing...
  1836.             strcpy(report.textfield[4], textBuffer[4]); // related problems
  1837.         }
  1838.     break;
  1839.     case ENH:
  1840.         strcpy(report.textfield[5], textBuffer[0]); // enhancement request
  1841.     break;
  1842.     default:
  1843.         ; // assert(0);
  1844.     break;
  1845.     }
  1846.  
  1847.     for (i = 0; i <= elements; i++)
  1848.     {   FreeVec((APTR) textBuffer[i]);
  1849.         textBuffer[i] = NULL;
  1850.     }
  1851.     closewindow();
  1852. }
  1853.  
  1854. MODULE ULONG Hook1Func(struct Hook *h, VOID *o, VOID *msg)
  1855. {   /* "When the hook is called, the data argument points to the
  1856.     window object and message argument to the IntuiMessage." */
  1857.  
  1858.     UWORD code, qual;
  1859.  
  1860.     geta4(); // wait till here before doing anything
  1861.     code = ((struct IntuiMessage *) msg)->Code;
  1862.     qual = ((struct IntuiMessage *) msg)->Qualifier;
  1863.     switch(code)
  1864.     {
  1865.     case SCAN_HELP:
  1866.         helpabout();
  1867.     break;
  1868.     case SCAN_ESCAPE:
  1869.         if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  1870.         {   cleanexit(EXIT_SUCCESS);
  1871.         } else
  1872.         {   page = 0;
  1873.         }
  1874.     break;
  1875.     case SCAN_B:
  1876.         if (report.type == BUG || (report.type == COM && report.severity != 3))
  1877.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE2]);
  1878.         } // "_bug generation procedure or example", when present, is always GID_1_TE2.
  1879.     break;
  1880.     case SCAN_D:
  1881.         if (report.type == BUG || (report.type == COM && report.severity != 3))
  1882.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE1]);
  1883.         } // "brief bug _description", when present, is always GID_1_TE1.
  1884.     break;
  1885.     case SCAN_E:
  1886.         if (report.type == ENH)
  1887.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE1]);
  1888.         } // "_enhancement request", when present, is always GID_1_TE1.
  1889.     break;
  1890.     case SCAN_I:
  1891.         if (report.type == BUG || (report.type == COM && report.severity != 3))
  1892.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE3]);
  1893.         } elif (report.type == COM && report.severity == 3)
  1894.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE1]);
  1895.         }
  1896.     break;
  1897.     case SCAN_R:
  1898.         if (report.type == BUG)
  1899.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE4]);
  1900.         } elif (report.type == COM && report.severity != 3)
  1901.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE5]);
  1902.         }
  1903.     break;
  1904.     case SCAN_W:
  1905.         if (report.type == COM && report.severity != 3)
  1906.         {   ActivateLayoutGadget(report_gadgets[GID_1_LY1], MainWindowPtr, NULL, (Object) report_gadgets[GID_1_TE3]);
  1907.         } // "_what developer is doing...", when present, is always GID_1_TE4.
  1908.     break;
  1909.     default:
  1910.     break;
  1911.     }
  1912.  
  1913.     return(1);
  1914. }
  1915.  
  1916. MODULE void updateemail(void)
  1917. {   if
  1918.     (   (!stricmp(subsystems[report.subsystem].unfriendly, "wormwars"))
  1919.      || (!stricmp(subsystems[report.subsystem].unfriendly, "report+"))
  1920.     )
  1921.     {   GT_SetGadgetAttrs
  1922.         (   TE11_EMailTo,
  1923.             MainWindowPtr,
  1924.             NULL,
  1925.             GTTX_Text, "amigansoftware@altavista.com",
  1926.             TAG_DONE
  1927.         );
  1928.     } else
  1929.     {   GT_SetGadgetAttrs
  1930.         (   TE11_EMailTo,
  1931.             MainWindowPtr,
  1932.             NULL,
  1933.             GTTX_Text, "support@haage-partner.com",
  1934.             TAG_DONE
  1935.         );
  1936. }   }
  1937.  
  1938.